package com.sky.mapper;

import com.sky.entity.OrderDetail;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Mapper
public interface OrderDetailMapper {
    @Select("SELECT name FROM order_detail WHERE order_id = #{orderId}")
    List<String> getNameByOrderId(Long orderId);


    @Select("SELECT * FROM order_detail WHERE order_id = #{orderId}")
    List<OrderDetail> setByOrderId(Long id);

    @MapKey("name")
    Map<String, Integer> selectTop10(LocalDateTime begin, LocalDateTime end);

    void insertBatch(List<OrderDetail> orderDetailList);
}
